package lanqiao;

import java.util.Scanner;

/**
 * @Project : ProgrammingExercises
 * @Package : LanQiao.Readay
 * @File : Q0504.java
 * @Author : WangRuoyu
 * @Date 2023/3/10 16:36
 */
public class Q0504 {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int[] words = new int[26];
        String str = scan.nextLine();

        for (int i = 0; i < str.length(); ++i) {
            words[str.charAt(i) - 'a']++;
        }

        int max = -1;
        char ch = 'a';

        for (int i = 0; i < words.length; ++i) {
            if (words[i] > max) {
                max = words[i];
                ch = (char) (i + 'a');
            }
        }

        System.out.println(ch);
        System.out.println(max);

        scan.close();

    }
}


